// curriculum//pages/inform/index.js
const api = require('../../../utils/api').apis;
// import format from '../../../format.js'
import { toDate,formatMsgTime } from '../../../utils/tool.js';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    name:'',
    img:'',
    course:'',
    er:'',
    coupon:'',
    id:'',
    siz:'',
  },
  infrom(){
    console.log(this.data.id)
    wx.redirectTo({
      url:'/curriculum/pages/course/index?id='+this.data.id,
      success: function(res){},
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
    var date = new Date()
var siz = toDate(date, 2)
// var aa = formatMsgTime(date)
    // console.log(aa)
    var coupon = options.coupon
    var id = options.id
    api.querySystem({ 

    }).then(res=>{
      console.log(res.data)
      this.setData({
        er:res.data.qrcode
      })
    })
    var value = wx.getStorageSync('userInfo')
    console.log(value)
    this.setData({
      name:value.username?value.username:value.nickName,
      img:value.userImgSrc?value.userImgSrc:value.avatarUrl,
      coupon:coupon,
      id:id,
      siz:siz

    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})